package com.test;

import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;

import static org.testng.Assert.assertEquals;

/**
 * Created by tandewei on 2017/2/16.
 */
public class CrabTestNG {

    @DataProvider(name = "testLegs")
    public Object[][] getDatasForTestLegs() {
        return new Object[][] {
                {0, 8},
                {1, 6},
                {2, 12},
                {-1, 12}
        };
    }

    @Test(dataProvider = "testLegs")
    public void testLegs(int type, int expected) throws Exception {
        Crab target = new Crab();
        int actual = target.legs(type);
        assertEquals(actual, expected);
    }

}